<?php $this->load->view(TEMPLATE_NAME.'/admin/header');?>

<?php $this->load->view(TEMPLATE_NAME.'/admin/side_left');?>

<link rel="stylesheet" type="text/css" media="all" href="<?php echo base_url()?>xhtml/admin/css/tia.css" />

<script type="text/javascript" src="<?php echo base_url()?>js/jquery-1.4.2.js"></script>

<script type="text/javascript" src="<?php echo base_url()?>js/jquery-ui.js"></script>

<script type="text/javascript" src="<?php echo base_url()?>js/jquery.validate.pack.js"></script> 

<link rel="stylesheet" type="text/css" media="all" href="<?php echo base_url();?>style/jquery-ui.css" />

<script type="text/javascript">       

$(document).ready(function(){

    $("#sys_calendar").datepicker({

        dateFormat: 'yy-mm-dd'

    });        

});

</script> 

<div class="page noright adminpage">

<h5 class="purple">The Mykprisguide Print - Design Directory</h5>

<hr />

<?php $this->load->view(TEMPLATE_NAME.'/admin/directory/directory_admin_header');?>

<hr />

<?php $this->load->view(TEMPLATE_NAME.'/admin/directory/directory_admin_editlisting_header');?> 

<hr />

<?php $action = 'admin/design_directory/activation/id/'.$company['id']; 

echo form_open($action);?>



<div class="forml"><span class="f14">Activation:</span></div><!-- forml -->

<?php if(!empty($notification)){ ?>

<p class="inform f12 error_message"><?php echo $notification ?></p>

<hr />

<?php } ?>

<div class="formr">

<div class="boxradio">

<input type="radio" name="activation" id="activate" value="activate" <?php if($company['listing_active'] == 1){ ?>checked="checked"<?php } ?> />

Activate and displays live</div>

<p class="boxradio" style="margin-bottom:0">        

<input type="radio" name="activation" id="deactivate" value="deactivate" <?php if($company['listing_active'] == 0){ ?>checked="checked"<?php } ?>/>

Deactivate and not displaying live</p>

</div><!-- formr -->

<div class="clear"></div>

<hr />

<div class="forml">&nbsp;</div><!-- forml -->

<div class="formr">

<?php

$form_button = array(

    'type'=>'submit',

    'name'=>'submit',

    'value'=>'activate',

    'content'=>'Submit',

);

echo form_button($form_button);

?>

<?php echo form_close();?>

</div><!-- formr -->

<div class="clear"></div>

<hr />

<br />

<hr />

<p class="f18">Payment History</p>

<hr />

<?php



if(!empty($company_invoice)){ 

foreach($company_invoice as $invoice){ ?>

<div class="f15">

<?php

   $action = 'admin/design_directory/activation/id/'.$company['id'].'/invoice_id/'.$invoice['id']; 

    echo form_open($action); 

    $form_button = array(

    'type'=>'submit',

    'name'=>'submit',

    'value'=>'delete_invoice',

    'class'=>'right',

	'style' => 'margin-top:8px',

    'content'=>'Delete',

    'onclick'=> "return confirm('Are you sure you want to delete this payment history item?');"

);

echo form_button($form_button);

echo form_close();?>

<strong>Payment - <?php echo date('d M Y',strtotime($invoice['paid_date']));?> - <?php echo $invoice['payment_in']?> - 

<?php

if($invoice['payment_type'] == '0'){

    $now = date('Y-m-d H:i:s'); 

    $difference = dateDiff($invoice['created_date'], $invoice['paid_until']);    

    $show_difference = explode(",", $difference);

    if(empty($show_difference[0])){

        echo $show_difference[1];

    }else{

        echo $show_difference[0];    

    }    

}else{

    switch($invoice['payment_type']){

        case '1':

            $monthsText = "6";

        break;

        case '2':

            $monthsText = "12";

        break;

        case '3':

            $monthsText = '24';

        break;

        default:

            $monthsText = "6";

        break;

    }

    echo $monthsText . " Months";    

} 

?> - R<?php echo number_format($invoice['total_paid'],2,'.',''); ?></strong><br />

<span class="purple">Expires <?php echo date('d M Y',strtotime($invoice['paid_until']));?></span>

<hr />     </div>

<?php } // end foreach

}else{

?>

<p class="f15 purple"><strong class="black">(No payment history)</strong>

<br />Make payment below</p>

<hr />

<?php

}?>

<div class="forml"><p class="f14">Notes:</p></div><!-- forml -->

<div class="formr">

<?php $action = 'admin/design_directory/activation/id/'.$company['id']; 

echo form_open($action);?>



<textarea name="admin_notes"><?php echo $company['admin_note']?></textarea>

</div><!-- formr -->

<div class="clear"></div>

<hr />

<div class="forml">&nbsp;</div><!-- forml -->

<div class="formr">

<?php 

$form_button = array(

    'type'=>'submit',

    'name'=>'submit',

    'value'=>'notes',

    'content'=>'Submit',

);

echo form_button($form_button); echo form_close();?>

</div><!-- formr -->

 

<div class="clear"></div>

<hr />

<br />

<hr />

<p class="f18">Manual payment allocation</p>

<hr />

<p class="f13 purple">Use this option to manually allocate payment record</p>

<hr />

<div class="forml">

<p class="f13">

<strong>

Amount Paid: <br /><br />

Paid via:<br /><br />

Expiry date:

</strong>

</p>

</div><!-- forml -->

<div class="formr f13">

<?php $action = 'admin/design_directory/activation/id/'.$company['id']; 

echo form_open($action,array('id' => 'manual_payment'));?>

<input type="text" name="total_paid" /> Indicated VAT inclusive amount in Rands<br />

<?php echo form_error('total_paid'); ?><br />

<select name="payment_method">

    <option value="">Select payment method</option>

    <option value="Bank Transfer">Bank Transfer</option>

    <option value="Cash">Cash</option>

    <option value="Credit Card">Credit Card</option>

    <option value="Free Subscription">Free Subscription</option>

</select><br />

<?php echo form_error('payment_method'); ?><br />

<a style="cursor:pointer;" onclick="javascript:$('#sys_calendar').datepicker('show');">

    <img src="<?php echo base_url()?>xhtml/img/ico_date.png" width="33" height="30" />

</a>

<input class="date" type="text" id="sys_calendar" name="expiry_date"/><br />

<?php echo form_error('expiry_date'); ?>

</div><!-- formr -->

<div class="clear"></div>

<hr />

<div class="forml">&nbsp;</div><!-- forml -->

<div class="formr">

<?php

$form_button = array(

    'type'=>'submit',

    'name'=>'submit',

    'value'=>'manual_payment',

    'content'=>'Submit',

);

echo form_button($form_button); echo form_close();?>

</div><!-- formr -->

<div class="clear"></div>

<hr />



</div><!-- page -->

<?php $this->load->view(TEMPLATE_NAME.'/admin/footer');?>